DDE Server
A Dynamic Data Exchange (DDE) server can be activated in HomSoft starting with Version V4. Homer must be equipped with the DDE option. Obviously, the HomSoft option is necessary for this, too. DDE enables another Windows application (DDE client) to receive measurement results from the Homer in the form of an ASCII string. The advantage is that you do not have to:
-
Write your own procedures for the data bytes reception, which may be a tricky task. (For more about communication, see the Homer Communication Protocol.)
-
Decode the received bytes, i.e., the Measurement Data Objects (MDO) to usable results (like incident power, reflection coefficient, frequency, tuning stub positions, etc.).
Generally, DDE transfer is defined by the names of three entities:
-
DDE Server is the DDE data producer name without the “EXE” extension. It may be, e.g., “Tu_rs”, “Tu_can”, or whatever you rename a HomSoft application to. The Homer simulation HoSim also includes a DDE server so you can test your client application before making the final decision to procure the DDE option.
-
DDE Topic is fixed to “HomerDdeTopic”.
-
DDE Item is fixed to “HomerDdeItem”.
Using these three names, DDE conversation can be established between your client application and the Homer Windows Software. For more information about DDE, refer to your particular programming environment. For an overview, please visit http://msdn.microsoft.com/en-us/library/ms648711(VS.85).aspx .
Homer DDE Results
After the connection is established, your client can receive Homer measurement results in the form of an ASCII string, consisting of individual result items separated by a delimiter.
The results appear in the following order:
Homer Status Byte (HST)
Homer Error Byte (HER)
Frequency in MHz
Magnitude of input reflection coefficient
Phase of input reflection coefficient
Magnitude of load (deembedded) reflection coefficient
Phase of load (deembedded) reflection coefficient
Incident power in watts
Reflected power in watts
Internal temperature in Celsius
Stub 1 position in steps (Stub 1 is closest to the generator)
Stub 2 position in steps
Stub 3 position in steps (Stub 3 is closest to the load)
Motor status byte 1 (MS1)
Motor status byte 2 (MS2)
For the meaning of HST, MS1, MS2, see the Homer Communication Protocol.
Possible delimiters are:
CRLF: a pair of bytes in the given order with decimal ASCII codes 13, 10 (carriage return + line feed).
Tab: the tab character (decimal ASCII code 9).
Space: the space character (decimal ASCII code 32).
Semicolon: the “;” character (decimal ASCII code 59).
To make HomSoft deliver results:
-
Check the Commun|DDE Server menu item (switch it ON).
-
Choose the delimiter by clicking the Commun|Delimiter menu item.
-
Choose the minimum period (maximum rate) of generating DDE messages by clicking the Commun|DDE Wait menu item. This will limit the cadence of DDE messages when the Homer produces results too fast. Fast cadence of DDE messages may overload the receive buffer of your DDE client application and even cause it or the PC to crash.
Application Speed Considerations
Please be aware that when your DDE client application is running together with HomSoft, both applications may get slower under certain circumstances (e.g., when using an older PC). This may be the case, for example, when your client is running in National Instrument’s LabVIEW environment. If, in this case, you experience a slowdown of HomSoft, multithreading must be switched off in your LabVIEW project.
To disable multithreading in LabVIEW versions starting V8.2, you must manually add the entry
ESys.StdNParallel=0
into the LabVIEW application ini file. In older versions, you can turn off multithreading in the LabVIEW menu item Tools|Options|Performance and Disk|Run with Multiple Threads.
You will have to restart LabVIEW for the changes to take effect. Please refer to National Instrument’s support web pages.
Importing to Excel
To import data to Microsoft Excel from, e.g., the simulation program HoSim.exe, enter the following function to a chosen cell:
=HOSIM|HomerDdeTopic!HomerDdeItem
Unfortunately, our experience is that Microsoft Excel does not receive data separated by CRLF or Tab (only the first result item, which is the Homer Status Byte HST). Therefore, you have to choose another delimiter (Space, Semicolon) and break up the received string yourself.
Sample DDE Client
A sample DDE client (Fig. 62) including the commented Delphi source code (a Delphi project packed as HmDdeClientSrc.zip), is included in the Homer installation as an aid and inspiration for writing your own client application.
Fig. 62. Sample DDE Client program.
To use the client program, proceed as follows:
-
Localize the DDE folder in your HomSoft installation folder and copy the whole DDE folder to some place in your user folder. Next, use only the files in this DDE copy.
-
Start the data producing program (e.g., HoSim.exe).
-
In its Commun menu, check the DDE Server item.
-
In the Commun menu, select the Delimiter, (e.g., CRLF).
-
In the Commun menu, set the DDE Wait in milliseconds (e.g., 500).
-
Start measurement.
-
Start HmDdeClient.exe program (the copy in your user folder).
-
Select or type the Server name (in this example, HoSim).
-
Set the Delimiter equal to that of the data producing program (in this example, CRLF).
-
Select the Connect method (e.g., Man).
-
Observe the bottom status bar, showing the link setting status (Not set, Set) and the link open status (Closed, Open).
-
Click . Now watch the displays being continuously refreshed.
-
If Connect = Auto, you can alternatively click for the same effect.
-
If Connect = Man, you can alternatively click , then for the same effect.
-
Observe the bottom status bar, showing the increasing count of received messages.
-
Click . Observe the status bar.
-
If the displays are frozen, click , then again.